<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
    <meta name="description" content="此代码内容为舒客旅游后台登录界面"/>
    <title>舒客旅游后台登录界面</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/admin/jq22.css">
</head>
<body>
<div id="login">
    <div class="wrapper">
        <div class="login">
            <form action="#" method="post" class="container offset1 loginform" id="myform">

                <div id="owl-login">
                    <div class="hand"></div>
                    <div class="hand hand-r"></div>
                    <div class="arms">
                        <div class="arm"></div>
                        <div class="arm arm-r"></div>
                    </div>
                </div>

                <div class="pad">
                    <input type="hidden" name="_csrf"
                           value="9IAtUxV2CatyxHiK2LxzOsT6wtBE6h8BpzOmk=">
                    <div class="control-group" id="alert" style="color:red;opacity:0;">
                        该用户不存在……
                    </div>
                    <div class="control-group">
                        <div class="controls">
                            <label for="email" class="control-label fa fa-envelope"></label>
                            <input id="username" type="text" name="username"
                                   placeholder="用户名" tabindex="1" autofocus="autofocus"
                                   class="form-control input-medium">
                        </div>
                    </div>
                    <div class="control-group">
                        <div class="controls">
                            <label for="password" class="control-label fa fa-asterisk"></label>
                            <input id="userpwd" type="password" name="userpwd"
                                   placeholder="密码" tabindex="2" class="form-control input-medium">
                        </div>
                    </div>
                    <div class="control-group" id="warning" style="color:red;opacity:0;">
                        密码有误，请重新输入 !
                    </div>
                </div>

                <div class="form-actions">
                    <button type="button" tabindex="4" class="btn btn-primary"
                            id="tologin">登录
                    </button>
                </div>

            </form>
        </div>
    </div>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>


    <script>
        $(function () {
            $('#login #password').focus(function () {
                $('#owl-login').addClass('password');
            }).blur(function () {
                $('#owl-login').removeClass('password');
            });

        });
    </script>
    <!-- cyf管理员后台登录校验 -->
    <script>
        $(document).ready(function () {
            $("#tologin").click(function () {
                /* alert("111");
                 document.write("11");
                 console.log(""); */
                //alert($("#userpwd").val());
                $.ajax({
                    url: "../../checkPwd",
                    type: "GET",
                    data: {
                        //将获取的文本框内容封装成user对象传过去校验
                        "aname": $("#username").val(),
                        "apwd": $("#userpwd").val()
                    },
                    success: function (data) {
                        if (data.msg != "密码错误") {
                            window.location.href = "homePage.jsp";
                        } else {
                            $('#warning').css("opacity", 1);
                        }
                    }
                })
            })
        })
    </script>
    <!-- 管理员后台登录校验 -->

    <!-- cyf管理员后台登录框失焦事件 -->
    <script>
        $(document).ready(function () {
            $("#username").change(function () {

                /* document.write("11");
                 console.log(""); */
                //alert($("#userpwd").val());
                $.ajax({
                    url: "../../checkName",
                    type: "GET",
                    data: {
                        //将获取的文本框内容封装成user对象传过去校验
                        "aname": $("#username").val(),
                    },
                    success: function (data) {
                        if (data.msg == "该用户不存在") {
                            //alert("该用户不存在");
                            $('#alert').css("opacity", 1);
                            $("#myform")[0].reset();//重新设置表单内容，清空了
                        } else {
                            $('#alert').css("opacity", 0);
                        }
                    }
                })
            })
        })
    </script>
    <!-- 管理员后台登录校验 -->
</div>
</body>
</html>